package com.community.interceptor;


import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

@Configuration
public class MyWebMvcConfigurerAdapter extends WebMvcConfigurationSupport {

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/**")
                .addResourceLocations("classpath:/META-INF/resources/")
                .addResourceLocations("classpath:/resources/")
                .addResourceLocations("classpath:/static/")
                .addResourceLocations("classpath:/public/")
                .addResourceLocations("file:D:/ideaSpace/collegeIntention/static/")
                .addResourceLocations("file:E:/D/WebstormProjects/vue demo/exprice/dist/")
                .addResourceLocations("file:static/");
        super.addResourceHandlers(registry);
    }

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new MyInterceptor())
                .addPathPatterns("/admin/main.html");
        registry.addInterceptor(new WxInterceptor()).addPathPatterns("/auth/**");
              /*  .addPathPatterns("/**")
                .excludePathPatterns("/free/**")
                .excludePathPatterns("/admin/**")
                .excludePathPatterns("/res/**")
                .excludePathPatterns("/error/**")
                .excludePathPatterns("/images/**")*/
        super.addInterceptors(registry);
    }
}
